package com.bdqn.demo.repository;

import com.bdqn.demo.pojo.SysRole;
import com.bdqn.demo.pojo.SysUser;
import com.bdqn.demo.util.UserInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

public interface UserRepository extends JpaRepository<SysUser,Long>, JpaSpecificationExecutor<SysUser> {

    @Query("select a.usrId as usrId,a.usrName as usrName ,a.usrPassword as usrPassword,b.roleName as roleName from SysUser a, SysRole b where a.usrRoleId=b.roleId and a.usrId=?1")
    public UserInfo getUserInfo(Long usrId);
}
